<?php include_once '../include/header.php' ?>
<?php include_once '../../usercontroller.php' ?>
<div id="panelNav">
    <div id="logo-featured"><img width="60" height="60"  src="../../Images/coupon.png" alt=""/><span>Phiếu giảm giá : Thêm mới phiếu giảm giá</span></div>
    <ul>
        <li><a href="#"><img src="../../Images/icon_cancel.png" class="qTip cancel" onclick="window.location='index.php'"  title="Đóng lại" border="0"/></a> </li>
        <li><a href="#"><img src="../../Images/icon_save_new.png" class="qTip save_new"  title="Lưu và tạo tiếp" border="0"/></a> </li>                
    </ul>
</div><!--end #menu_news-->
<div class="ui-corner-all" style="display:none;height:30px;line-height: 30px;margin-top: 20px; padding: 0 .7em;">
    <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;margin-top:.7em;"></span>
        <strong></strong></p>
</div>
<div id="content">
    <div id="main-container">
        <div id="tabs1">
            <ul>
                <li><a href="#tabs-1">Thông tin tài khoản</a></li>                
            </ul>
            <div id="tabs-1">
                <div style="margin: 10px">
                <form id="create" action="" method="POST" enctype="multipart/form-data">
                    <input type="hidden" name="checkSubmit" id="checkSubmit" value="submit" />
                    <fieldset class="create-form">
                        <legend>Thông tin thành viên</legend>
                        <table cellpadding="8" cellspacing="8">
                            <tr>
                                <td>Mã sinh viên:<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="text-input" id="masv" name="masv" value="" size="30" />
                                    <div id="UsernameExist" class="ssss" ></div>
                                </td>
                            </tr>
                            <tr>
                                <td>Tên tài khoản<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="text-input" id="taikhoan" name="taikhoan" value="" size="30" />
                                    <div id="UsernameExist" class="ssss" ></div>
                                </td>
                            </tr>
                            <tr>
                                <td>Mật khẩu<span style="color:#f00">*</span> </td>
                                <td><input type="password" class="text-input" id="matkhau" name="matkhau" value="" size="30"/></td>
                            </tr>
                            <tr>
                                <td>Nhập lại mật khẩu<span style="color:#f00">*</span> </td>
                                <td><input type="password" class="text-input" id="matkhau2" name="matkhau2" value="" size="30"/><div id="passs" class="ssss"></div></td>
                            </tr>
                            <tr>
                                <td>Họ và tên<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="fullname" name="fullname" value="" size="30"/></td>
                            </tr>
                            <tr>
                                <td>Ngày sinh<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="ngaysinh" name="ngaysinh" value="" size="30"/></td>
                            </tr>
                            <tr>
                                <td>Giới tính<span style="color:#f00">*</span> </td>
                                <td><input name="gioitinh" value="Nam" type="radio" checked />Nam <input name="gioitinh" value="Nữ" type="radio" />Nữ </td>
                            </tr>
                            <tr>
                                <td>Quê quán<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="quequan" name="quequan" value="" size="50"/></td>
                            </tr>
                            <tr>
                                <td>Địa chỉ hiện tại<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="diachi" name="diachi" value="" size="50"/></td>
                            </tr>
                            <tr>
                                <td>Email<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="email" name="email" value="" size="30"/></td>
                            </tr>                   
                            <tr>
                                <td>Số điện thoại<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="sodienthoai" name="sodienthoai" value="" size="30"/></td>                            
                            </tr>
                            <tr>
                                <td>Nghề nghiệp:<span style="color:#f00">*</span> </td>
                                <td><input type="text" class="validate text-input" id="nghenghiep" name="nghenghiep" value="" size="30"/></td>                            
                            </tr>
                            <tr>
                                <td>Tài khoản Yahoo!<span style="color:#f00"></span> </td>
                                <td><input type="text" class=" text-input" id="yahoo" name="yahoo" value="" size="30"/></td>
                            </tr>
                            <tr>
                                <td>Tài khoản Skype<span style="color:#f00"></span> </td>
                                <td><input type="text" class=" text-input" id="skype" name="skype" value="" size="30"/></td>
                            </tr>
                            <tr>
                                <td>Tài khoản Facebook<span style="color:#f00"></span> </td>
                                <td><input type="text" class=" text-input" id="facebook" name="facebook" value="" size="30"/></td>
                            </tr>
                                               
                            <tr>
                                <td>Avatar <span style="color:#f00">*</span></td>
                                <td><input type="file" id="avatar" name="avatar" value="" size="30"/></td>
                            </tr>                    
                            <tr>
                                <td>Trạng thái <span style="color:#f00">*</span></td>
                                <td><select name="status" class="validate" id="delete_status">
                                        <option value="1">Kích hoạt</option>
                                        <option value="0">Bỏ Kích hoạt</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                        <div style="margin: 5px;">
                            Miêu tả bản thân <span style="color:#f00">*</span><textarea cols="" rows=""  id="description" name="description" style="height:300px;width:800px;overflow: scroll;font-size:11px; "></textarea>
                        </div>
                    </fieldset>
                </form>
                </div>
            </div>
        </div>

    </div>
    <script type="text/javascript">
        (function($)
        {
            $('#description').wysiwyg({
                controls: {
                    strikeThrough : { visible : true },
                    underline     : { visible : true },

                    separator00 : { visible : true },

                    justifyLeft   : { visible : true },
                    justifyCenter : { visible : true },
                    justifyRight  : { visible : true },
                    justifyFull   : { visible : true },

                    separator01 : { visible : true },

                    indent  : { visible : true },
                    outdent : { visible : true },

                    separator02 : { visible : true },

                    subscript   : { visible : true },
                    superscript : { visible : true },

                    separator03 : { visible : true },

                    undo : { visible : true },
                    redo : { visible : true },

                    separator04 : { visible : true },

                    insertOrderedList    : { visible : true },
                    insertUnorderedList  : { visible : true },
                    insertHorizontalRule : { visible : true },

                    h4mozilla : { visible : true && $.browser.mozilla, className : 'h4', command : 'heading', arguments : ['h4'], tags : ['h4'], tooltip : "Header 4" },
                    h5mozilla : { visible : true && $.browser.mozilla, className : 'h5', command : 'heading', arguments : ['h5'], tags : ['h5'], tooltip : "Header 5" },
                    h6mozilla : { visible : true && $.browser.mozilla, className : 'h6', command : 'heading', arguments : ['h6'], tags : ['h6'], tooltip : "Header 6" },

                    h4 : { visible : true && !( $.browser.mozilla ), className : 'h4', command : 'formatBlock', arguments : ['<H4>'], tags : ['h4'], tooltip : "Header 4" },
                    h5 : { visible : true && !( $.browser.mozilla ), className : 'h5', command : 'formatBlock', arguments : ['<H5>'], tags : ['h5'], tooltip : "Header 5" },
                    h6 : { visible : true && !( $.browser.mozilla ), className : 'h6', command : 'formatBlock', arguments : ['<H6>'], tags : ['h6'], tooltip : "Header 6" },

                    separator07 : { visible : true },

                    cut   : { visible : true },
                    copy  : { visible : true },
                    paste : { visible : true }    
                }
            });
        })(jQuery);
        $("#tabs1").tabs();
        $(".save_new").click(function(){
            var check = checkvalidate();
            if(check){
                $("#create").submit(); 
            }            
        });
        $('#taikhoan').keyup(function(){
        var name=$(this).val();
        if(name.length<4){
            $('#UsernameExist').html("<img src='../../Images/icon_alert.png' valign='midle' /> ").css("display","inline");
        } else{
            $.post("../../controllers/usercontroller.php?action=checkName&name="+name,null,function(data){
                if(data==true){
                    $('div#UsernameExist').html("<img src='../../Images/icon_active.png' height='18' valign='midle' /> ").css("display","inline");
                    $(this).focus().css("border", "1px solid #f00");
                }
                else{
                    $(this).css("border","1px solid #cecece");
                    $('div#UsernameExist').html("<img src='../../Images/icon_alert.png' height='18' valign='midle' /> ").css("display","inline");
                }
            });
        }
         
    });
    $('#matkhau2').change(function(){
        var txt=$(this).val();
        var txt1=$('#matkhau').val();
        if(txt!=txt1||txt1.length<6){
            $(".ui-corner-all").addClass("error");
            $(".ui-corner-all p strong").html("Mật khẩu quá ngắn hoặc không khớp !");
            $(".ui-corner-all").fadeTo("slow", 1);
            //setTimeout("$('.ui-corner-all').slideUp('slow');","2000");
            $('#matkhau').val("").focus().css("border","1px solid #f00");
            $('#matkhau2').val("").css("border","1px solid #f00");
            $('#passs').html("");
        }else{
            $('#matkhau').css("border","1px solid #cecece");
            $('#matkhau2').css("border","1px solid #cecece");
            $('#passs').html("<img src='../../Images/icon_active.png' height='18' valign='midle' /> ").css("display","inline");
        }
        
    });
    $('input#sodienthoai').change(function(){
        t=/^\d{10}$/
        var v=$(this).val();
        if(t.test(v)==false){
            $(this).css("border","1px solid #f00");
            $(this).focus();
        } else{
            $(this).css("border","1px solid #cecece");
        }
    });
    $('input#email').change(function(){
        t = /^\w+@\w+(\.\w{2,3})+$/
        var v=$(this).val();
        if(t.test(v)==false){
            $(this).css("border","1px solid #f00");
            $(this).focus();
        } else{
            $(this).css("border","1px solid #cecece");
        }
    });
    function checkvalidate(){
        var check=true;
        $('input.validate').each(function(){
            var txt=$(this).val();
            if(txt.length<6){
                $(this).css("border","1px solid #f00");
                check=check&&false;
            } else{
                $(this).css("border","1px solid #cecece");
                check=check&&true;
            }
        });
        return check;
    }
    </script>
</div>
<?php include_once '../include/footer.php' ?>